Hi to all ,
I have a field that I have used to store multiple values and used the following example to create diferent records after I hit the add button
https://xlinesoft.com/phprunner/docs/select_multiple_values.htm
but then it returns an error where the error is the list page I am trying to redirect!
my code is as follows
if ($values['propertyid']) {
$arr = explode(",",$values["propertyid"]);
for ($i=0;$i<count($arr);$i++)
{
$strInsert = "insert into proprequest(status,origin,introfrom,code,custid,propertytype,propcategory,requestreason,dateuntilrequest,requesttimeframe,paymentterms,pricefrom,priceto,sizefrom,sizeto,bedroomsfrom,bedrommsto,floorfrom,floorto,constructfrom,constructto,transtype,branchid,propertyid)";
$strInsert.= "values (".$status.",".$origin.",".$introfrom.",(select getnewreqcode()),".$custid.",".$propertytype.",".$propcategory.",".$requestreason.",".$dateuntilrequest.",".$requesttimeframe;
$strInsert.= ",".$paymentterms.",".$pricefrom.",".$priceto.",".$sizefrom.",".$sizeto.",".$bedroomsfrom.",".$bedrommsto.",".$floorfrom.",".$floorto.",".$constructfrom.",".$constructto.",".$transtype.",(select branchid from property where id = ".$arr[$i]."),".$arr[$i].")";
db_exec($strInsert,$conn);
$newid = mysqli_insert_id($conn);
$strInsertArea = "insert into reqarea (reqid,areaid,userid,dateadded,active) ";
$strInsertArea .= "values (".$newid.",ifnull((select nareaid from areas a , property p where p.id = ".$arr[$i]." and a.nLevel3Code = p.district),(select nareaid from areas a , property p where p.id = ".$arr[$i]." and a.nLevel2Code = p.city and a.nLevel2descr is not null and nLevel3descr is null))";
$strInsertArea .= ",".$_SESSION["uid"].",now(),1)";
db_exec($strInsertArea);
}
// Exit and Redirect to the list page after updating database
header("Location: proprequest_list.php?a=return");
exit();
}
else {
$values['code']=DBLookup("select getnewreqcode()");
return true;
}
The insert is done correct , but the redirect fails as shown below